package gam.n1.ent;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import gam.n1.areas.Area;
import org.bukkit.entity.Entity;

import java.util.*;

public final class AEntityManager {
    private static Map<Area,List<AEntity>> entities;

    public static void a(Area area,AEntity entity){
        Objects.requireNonNull(area);
        Objects.requireNonNull(entity);
        if (entities == null){
            entities = Maps.newLinkedHashMap();
        }
        List<AEntity> var1 = entities.get(area);
        if (var1 != null){
            var1.add(entity);
        } else {
            entities.put(area, Lists.newLinkedList(Collections.singletonList(entity)));
        }
    }
    public static boolean i(AEntity entity){
        Objects.requireNonNull(entity);
        if (!entities.isEmpty()){
            for (Area var2 : entities.keySet()) {
                if (entities.get(var2).contains(entity)) {
                    return true;
                }
            }
        }
        return false;
    }
    public static boolean i(Entity entity){
        Objects.requireNonNull(entity);
        if (!entities.isEmpty()){
            for (List<AEntity> var1 : entities.values()) {
                for (AEntity var2 : var1) {
                    if (var2.getAEntity() == entity){
                        return true;
                    }
                }
            }
        }
        return false;
    }
}
